package alpaca.core;


import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * Created to combine a user object with many contacts.
 * Just needed for the database.
 */
@DatabaseTable(tableName = "contacts")
public class UserContact {
	
	@DatabaseField(generatedId = true)
	private int id;
	
	@DatabaseField(canBeNull = false, columnName = "userId", foreign = true)
	private ORMLiteUser user;
	
	@DatabaseField(canBeNull = false, columnName = "contactId", foreign = true, foreignAutoRefresh = true)
	private ORMLiteUser contact;
	
	@DatabaseField
	private String tag;

	@Deprecated
	public UserContact() {
		// for ORMLite
	}
	
	public UserContact(ORMLiteUser user, ORMLiteUser contact, String tag) {
		this.user = user;
		this.contact = contact;
		this.tag = tag;
	}

	public ORMLiteUser getContact() {
		return contact;
	}
	
	public String getTag() {
		return tag;
	}
	
}
